<%
String peopleId = request.getParameter("peopleId");
%>
<html>
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
     <style type="text/css">
            @import "../dojo/dojo-release-1.0.0/dijit/themes/tundra/tundra.css";
            @import "../dojo/dojo-release-1.0.0/dojo/resources/dojo.css";
            @import "../dojo/dojo-release-1.0.0/dojox/grid/_grid/tundraGrid.css";
            @import "../dojo/dojo-release-1.0.0/dojox/grid/_grid/Grid.css";
            @import "../js/dijitTests.css";
            @import "../js/wlProject.css";
	
      </style>
      <script type="text/javascript" src="../dojo/dojo-release-1.0.0/dojo/dojo.js"  
                djConfig="parseOnLoad: true, isDebug: true,locale: 'zh-cn', extraLocale: ['zh-TW', 'fr']"></script>
      <script>
    
            dojo.require("dojo.data.ItemFileWriteStore");
            dojo.require("dojo.parser");
            dojo.require("dijit.form.Button");
            dojo.require("dijit.Menu");
            dojo.require("dojox.grid.Grid");
            dojo.require("dojox.validate._base");
            dojo.require("dojox.grid._data.model");
            dojo.require("dijit.form.ValidationTextBox");
            dojo.require("dijit.form.TextBox");
            dojo.require("dijit.form.FilteringSelect");
            dojo.require("dijit.form.ComboBox");
            dojo.require("dijit.form.Textarea");
            dojo.require("dojox.grid._data.dijitEditors");
            
            dojo.registerModulePath("mydojo", "../../../js/mydojo");
            dojo.require("mydojo.FilteringSelect");
            dojo.require("mydojo.ValidationTextBox");
            dojo.require("mydojo.NumberTextBox");
     </script>
        
     <script type="text/javascript" src="../js/soapclient.js"></script>
     <script type="text/javascript" src="../js/wlProject.js"></script>
     <script type="text/javascript" src="../js/wlordervo.js"></script>
     <script type="text/javascript" >
          var url = getUrl()+ "services/WlorderManageService";
          var griddata =  new Array();
          var deletedata =  new Array();
          var deletedataSub =  new Array();
          var addInt=0;
          var querydata =  new Array();
          var gridSubdata =  new Array(); 
          var gridSubdata1 =  new Array();
          var querySubdata =  new Array(); 
          var pagenumber=1;
          var pagesize=10;
          var totalCount=0;
          var queryvo;
          // = new WlOrderVOJs(); //
          
         formatNum = function(inDatum) {
           return (0==inDatum)? '0' : parseFloat(inDatum).toFixed(4);
         } 
         
      function buildSubgrid(inRowIndex, inCell) {
        	//alert("1");
				var n = inCell.getNode(inRowIndex).firstChild;
				
        //alert("n:"+n);
				var t=inCell.getNode(inRowIndex).lastChild;
				// alert("t:"+t);
				var id = makeSubgridId(inRowIndex);
				//alert("id:"+id);
			  var id1 = makeSubgridId1(inRowIndex);
			  //alert("id1:"+id1);
				var subGrid = dijit.byId(id);
				var subGrid1 = dijit.byId(id1);
				gridSubdata1=querydata[inRowIndex][32];//\u5c55\u5f00\u7684orderRow\u6570\u636e
				querySubdata=querydata[inRowIndex];//\u5c55\u5f00\u7684order\u6570\u636e
        if (subGrid) {
					if(n==undefined)n = inCell.getNode(inRowIndex).firstChild;
          n.appendChild(subGrid.domNode);
					//	alert("2");
				} else {
					subGridProps.dataRow = inRowIndex;
					//alert("subGridProps.dataRow:"+subGridProps.dataRow);
					//subGridProps.widgetId = id;
					subGridProps.id = id;
					subGrid = new dojox.VirtualGrid(subGridProps, n);
					//	alert("4");
        }
				var subGridProps1=0;
				if(gridSubdata1.length!=0){
					 subGridProps1 = {
      				structure: layoutSub1,
              rowCount: gridSubdata1.length,  
              autoHeight: true,
              autoRender: false,
      				"get": getSubDetailData
      			};
				if (subGrid1) {
					destroySubgrid1(inRowIndex);
					subGrid1 = new dojox.VirtualGrid(subGridProps1, t);
					//alert('9');
				} else {
				  subGridProps1.dataRow = inRowIndex;
					//subGridProps1.widgetId = id1;
					subGridProps1.id = id1;
					subGrid1 = new dojox.VirtualGrid(subGridProps1, t);
				//	alert('3');
				}}
				
				if (subGrid) {
					subGrid.render();
					subGrid.cacheHeight = subGrid.domNode.offsetHeight;
				}	
				if (subGrid1) {
				  
          subGrid1.render();
          subGrid1.cacheHeight = subGrid1.domNode.offsetHeight;
				}	
				//	alert("8");
				inCell.grid.rowHeightChanged(inRowIndex);
				//	alert("7");
			}      
		  
		  
			 getSubDetailData = function(inRowIndex) {
		  
				return	gridSubdata1[inRowIndex][this.index+2];
				
			}
 function getDetail(inRowIndex) {
               //alert("getDetail:"+inRowIndex);
          			var cell = this;
          			setTimeout(function() { buildSubgrid(inRowIndex, cell); }, 0);
          			// look for a subgrid
          			var subGrid = dijit.byId(makeSubgridId(inRowIndex));
          			var subGrid1 = dijit.byId(makeSubgridId1(inRowIndex));
          			var h = (subGrid ? subGrid.cacheHeight : "120") + "px";
          			var h1 = (subGrid1 ? subGrid1.cacheHeight : "0") + "px";
          			// insert a placeholder
          			
          			return '<div style="height:'+h+'; background-color: white;"></div><div style="height:'+h1+'; background-color: white;"></div>';
		    }			
function allopen(){
 // for(var i =0;i<querydata.length;i++){ detailRows[i] = true;}
    //  dijit.byId("grid").updateRowCount(querydata.length);  
       for(var i =0;i<querydata.length;i++){
            /*var g=dijit.byId("grid").getCell(0);
            var gg = g.getNode(i).firstChild;
            gg.onclick();*/
            toggle(i,true);
           
          }
 }  
function allclose(){
          for(var i =0;i<querydata.length;i++){
            toggle(i,false);
          }
}  			
function onBeforeRow(inDataIndex, inRow) {
//alert("inRow:"+inRow);
   if (inRow[1]!=undefined)inRow[1].hidden = !detailRows[inDataIndex];
   }			
      var layout =[{
                    	onBeforeRow: onBeforeRow,
             cells: [
                      [
                       { name: 'detail', width: 3, get: getCheck, styles: 'text-align: center;' },
                       { name: 'No.', width: 2, styles: 'text-align: center;', get: function(inRowIndex){ return inRowIndex+1;} },//
                          /*{name: '\u5185\u90e8\u8ba2\u5355\u53f7', width: 10,get:function(inRowIndex){return  querydata[inRowIndex][1];}},
                          {name: '\u5ba2\u6237\u8ba2\u5355\u53f7', width: 10,get:function(inRowIndex){ return querydata[inRowIndex][2];}},
                          {name: '\u5ba2\u6237\u540d\u79f0', width: 20,get:function(inRowIndex){ return querydata[inRowIndex][27];}},
                          {name: '\u8d27\u7269\u7b14\u6570', get:getSum1},
                          {name: '\u8d27\u7269\u91cd\u91cf\u5408\u8ba1', get:getSum2 },
                          {name: '\u8d27\u7269\u4f53\u79ef\u5408\u8ba1', get:getSum3 },
                          {name: '\u8fd0\u8f93\u8def\u5f84', width: 10,get:function(inRowIndex){ return querydata[inRowIndex][28];}},
                          {name: '\u9884\u5b9a\u63d0\u8d27\u65f6\u95f4',width: 10,get:function(inRowIndex){ return querydata[inRowIndex][16];}},
                          {name: '\u9884\u5b9a\u9001\u3001\u5378\u8d27\u65f6\u95f4', width: 10,get:function(inRowIndex){ return querydata[inRowIndex][21];}},
                          {name: '\u4f18\u5148\u7ea7', width: 10,get:function(inRowIndex){return querydata[inRowIndex][8];}}*/
                          {name: 'order', width: 10,get:function(inRowIndex){return  querydata[inRowIndex][1];}},
                          {name: 'customerCode', width: 10,get:function(inRowIndex){ return querydata[inRowIndex][2];}},
                          {name: 'customer', width: 20,get:function(inRowIndex){ return querydata[inRowIndex][36];}},
                          {name: 'sum', get:getSum1},
                          {name: 'weightSum', get:getSum2 },
                          {name: 'voSum', get:getSum3 },
                          {name: 'path', width: 10,get:function(inRowIndex){ return querydata[inRowIndex][44];}},
                          {name: 'planFetchtime',width: 10,get:function(inRowIndex){ return querydata[inRowIndex][19];}},
                          {name: 'unloadtime', width: 10,get:function(inRowIndex){ return querydata[inRowIndex][25];}},
                          {name: 'level', width: 10,get:function(inRowIndex){return querydata[inRowIndex][8];}}
                      ],[
			                    { name: 'uuu', get: getDetail, colSpan: 12,styles: 'padding: 0; margin: 0;'}
			                  ]
                      ]
                    }];
      
		  var layoutSub1 =[{type: 'dojox.GridRowView', width: '20px' },{
		                noscroll: true,
                  cells: [     [
                                {name: 'productCode',width: 10 },
                                {name: 'productName',width: "auto" },
                                {name: 'productEquType',width: 10 },
                                {name: 'measureUnit',width: 6},
                                {name: 'productNum',width: 6},
                         {name: 'unitNum' ,width: 6},
                         {name: 'goodsSuttle' ,width: 6},
                         {name: 'goodsWeight'  ,width: 6},
                         {name: 'goodsVolume' ,width: 6},
                         {name: 'label' ,width: 10 },
                         {name: 'carriage' },
                            {name: 'especial',width: 10 },
                            {name: 'goodsState' ,width: 6},
                         // {name: 'status' },
                         //{name: 'version'  },
                            {name: 'remark',width: 10 }

                         ]]
                          }];
/*  var yearlyTotal=0;
  function getProductNumTotal(inRowIndex) {
            return modelSub.getRow(inRowIndex) ? (yearlyTotal += modelSub.getRow(inRowIndex).productNum) : -1;
        }
    function onAfterRow(inDataIndex, inRow) {
    alert(inDataIndex);
    alert(inRow);
    // note that header row inDataIndex == -1
   if (inRow[1]!=undefined){
   // Before rows 3, 7, 11 turn on display of the total
    if ( inDataIndex== gridSubdata.length) {
    inRow[1].hidden = false;}else{
          	yearlyTotal = 0;
        inRow[1].hidden =true ;
    }}
}*/
        var layoutSub2 =[{type: 'dojox.GridRowView', width: '20px' },{ //onAfterRow: onAfterRow,
                  cells: [
                      [
                       //{ name: 'choise', width: 3, styles: 'text-align: center;', editor: dojox.grid.editors.Bool },//
                       //{ name: 'No.', width: 2, styles: 'text-align: center;', get: function(inRowIndex){ if(inRowIndex!=gridSubdata.length-1){return inRowIndex+1;}else{return '';} }},//
                          { name: 'No.', width: 2, styles: 'text-align: center;', get: function(inRowIndex){ return inRowIndex+1;}},//
                        {name: 'productCode', field: 2,width: 10, editor: mydojo.ValidationTextBox , required:false ,maxLength:100,invalidMessage:'' }
                         ,   {name: 'productName', field: 3,width: 10, editor: mydojo.ValidationTextBox , required:false ,maxLength:100,invalidMessage:'' }
                         ,   {name: 'productEquType', field: 4,width: 10, editor: mydojo.ValidationTextBox , required:false ,maxLength:100,invalidMessage:'' }
                         ,   {name: 'measureUnit', field: 5,width: 6 , editor: mydojo.ValidationTextBox ,required:true ,maxLength:30,invalidMessage:'can not be empty'}
                       ,  {name: 'productNum',field:6, width: 10, editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4 } }
                       ,  {name: 'unitNum',field:7, width: 6,editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4 }}
                       ,  {name: 'goodsSuttle',field:8, width: 6,editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4} }
                       ,  {name: 'goodsWeight',field:9, width: 6,editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4} }
                       ,  {name: 'goodsVolume',field:10, width: 6,editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4} }
                         ,   {name: 'label', field: 11,width: 10, editor: mydojo.ValidationTextBox , required:false ,maxLength:100,invalidMessage:'' }
                       ,  {name: 'carriage',field:12, width: 6,editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4} }
                         ,   {name: 'especial', field: 13,width: 10, editor: mydojo.ValidationTextBox , required:false ,maxLength:100,invalidMessage:'' }
                         ,   {name: 'goodsState', field: 14,width: 6, editor: mydojo.ValidationTextBox , required:false ,maxLength:100,invalidMessage:'' }
                        // ,   {name: 'status', field: 15,width: 15 , editor: mydojo.ValidationTextBox ,required:true ,maxLength:30,invalidMessage:'can not be empty'}
                      // ,  {name: 'version',field:16, width: 8,editor: dojox.grid.editors.Dijit, editorClass: "dijit.form.NumberTextBox", constraint: {min:0,max:9999999,places:4} }
                       ,   {name: 'remark', field: 15,width: 10, editor: mydojo.ValidationTextBox , required:false ,maxLength:100,invalidMessage:'' }

                         ]
                         /*,[
                      	    // The summary subrow, which will be hidden on most rows
                      		{name: '\u5408\u8ba1',  colSpan: 6,get: function(inRowIndex){ return '';} },
                      		{name: 'productNum', get:getProductNumTotal, styles:'font-weight:bold;'},
                      		{name: '',  colSpan: 11,get: function(inRowIndex){ return '';} }
                      	]*/
                     ]
                          }];                   
       var layoutSub =[{type: 'dojox.GridRowView', width: '20px' },{
                   noscroll: true,
                   cells: [  [
                           //  {name: 'pathName',width: 10,get:function(inRowIndex){  return querySubdata[1];}}
                             {name: 'bookTime', width: 8,get:function(inRowIndex){ return querySubdata[13];}}
                         ,   {name: 'planFetchTime', width: 8,get:function(inRowIndex){ return querySubdata[16];}}
                         ,   {name: 'fetchCompanyName',width: "auto",get:function(inRowIndex){ return querySubdata[17];}}
                         ,   {name: 'fetchCompanyAddress',width: 20,get:function(inRowIndex){ return querySubdata[18];} }
                         ,   {name: 'fetchMan',width: 10,get:function(inRowIndex){ return querySubdata[19];}}
                         ,   {name: 'fetchTel',width: 10,get:function(inRowIndex){ return querySubdata[20];}}
                         ,   {name: 'customerType', width: 10,get:function(inRowIndex){ return querySubdata[9];}}   
                         ,   {name: 'contractNo',width: 10,get:function(inRowIndex){ return querySubdata[3];}}
                         ,   {name: '\u8868\u5355\u72b6\u6001', width: 6,get:function(inRowIndex){ return querySubdata[15];}}
                         ,   {name: 'shipperRemark',width: 10,get:function(inRowIndex){ return querySubdata[6];}}
                         //,   {name: 'carrierRemark'}
                         ],      
                          [
                            {name: 'conveyance',get:function(inRowIndex){ return querySubdata[4];}}
                         //,   {name: 'carryType',get:function(inRowIndex){ return querySubdata[1];}}
                         ,   {name: 'planUnloadTime',get:function(inRowIndex){ return querySubdata[21];}}
                         ,   {name: 'unloadCompanyName' ,get:function(inRowIndex){ return querySubdata[22];}}
                         ,   {name: 'unloadCompanyAddress',get:function(inRowIndex){ return querySubdata[23];} }
                         ,   {name: 'unloadMan',get:function(inRowIndex){ return querySubdata[24];}}
                         ,   {name: 'unloadTel' ,get:function(inRowIndex){ return querySubdata[25];}}
                         ,   {name: 'referTime' ,get:function(inRowIndex){ return querySubdata[10];}}
                         ,   {name: 'linkMan',get:function(inRowIndex){ return querySubdata[11];}}
                         ,   {name: 'tel',get:function(inRowIndex){ return querySubdata[12];}}
                         ,   {name: 'remark' ,get:function(inRowIndex){ return querySubdata[26];}}
                          //{name: 'completeTime', width: 7}
                          ]
                     ]
                          }];          
        
       
           
                                  
           function get(inRowIndex){
        	      if(inRowIndex<querydata.length){
        	   		    return querydata[inRowIndex][this.index];
        	   		}else{
                    return ''; 
                }
        			}   
        			
     getDetailData = function(inRowIndex) {
		    return	querydata[inRowIndex][this.index];
				
			}                           
			var subGridProps = {
				structure: layoutSub, 
				rowCount: 1, 
				autoHeight: true, 
				//autoWidth: true, 
				autoRender: false
				//style:"{width:100%}",
				//"get": getDetailData
			};
		
	
			// identify subgrids by their row indices
			function makeSubgridId(inRowIndex) {
				return "_subGrid_" + inRowIndex;
			}
			
			function makeSubgridId1(inRowIndex) {
				return "_subGrid1_" + inRowIndex;
			}
			function destroySubgrid(inRowIndex) {
				var subGrid = dijit.byId(makeSubgridId(inRowIndex));
				if (subGrid) subGrid.destroy();
			}
			function destroySubgrid1(inRowIndex) {
				var subGrid1 = dijit.byId(makeSubgridId1(inRowIndex));
				if (subGrid1) subGrid1.destroy();
			}
	                                   formatDate = function(inDatum){
                                  		  if(Boolean(dojo.date.locale.parse(inDatum, { datePattern: "yyyy-mm-dd", timePattern: "HH:mm"}))){
                                        
                                        return dojo.date.locale.format(new Date(inDatum),{ datePattern: "yyyy-mm-dd", timePattern: "HH:mm"});
                                         }else{
                                         alert("can not be format");
                                         return inDatum;}
                                  		}
        	      
        	function getSum1(inRowIndex) {
            	var subdataArray=querydata[inRowIndex][32];
            	//alert("inRowIndex:"+inRowIndex+"  subdataArray:"+subdataArray+"subdataArray.length:"+subdataArray.length);
            	return subdataArray.length;
        	}
        	function getSum2(inRowIndex) {
        	    var subdataArray=querydata[inRowIndex][32];
            	var sumProductnum=new Number(0);
            	for(var i=0;i<subdataArray.length;i++){
            	sumProductnum=sumProductnum+new Number(subdataArray[i]["ns:goodsWeight"]);
            	
            	}
        				return sumProductnum;
        	}
        	function getSum3(inRowIndex) {
        	    var subdataArray=querydata[inRowIndex][32];
            	var sumProductnum=new Number(0);;
            	for(var i=0;i<subdataArray.length;i++){
            	sumProductnum=sumProductnum+new Number(subdataArray[i]["ns:goodsVolume"]);
              
              }
        				return sumProductnum;
        	}  
        	function getCheck(inRowIndex) {
        				//if (!this.grid.expandedRows)
                //this.grid.expandedRows = [ ];
                //alert("getCheck:"+detailRows[inRowIndex]);
        				var image = (detailRows[inRowIndex] ? 'open.gif' : 'closed.gif');
        				var show = (detailRows[inRowIndex] ? 'false' : 'true');
        			return '<img src="../image/' + image + '" onclick="toggle(' + inRowIndex + ', ' + show + ')" height="11" width="11">';
        			}
      function detachSubgrid(inRowIndex) {
				var subGrid = dijit.byId(makeSubgridId(inRowIndex));
				if (subGrid)
					dojox.grid.removeNode(subGrid.domNode);
			}    
      function detachSubgrid1(inRowIndex) {
				var subGrid1 = dijit.byId(makeSubgridId1(inRowIndex));
				if (subGrid1)
					dojox.grid.removeNode(subGrid1.domNode);
			}        
               
           detailRows = [];                            
        	function toggle(inIndex, inShow) {
        				//grid.expandedRows[inIndex] = inShow;
        				//grid.updateRow(inIndex);
        				if (!inShow) detachSubgrid(inIndex);
        				if (!inShow) detachSubgrid1(inIndex);
			           detailRows[inIndex] = inShow;
			           dijit.byId("grid").updateRow(inIndex);
        				
        			}       
        
        
         var url1 = getUrl()+ "services/CustomerManageService";
          
              var p = new SOAPClientParameters();
              p.add('status',"0");
              p.add('sort',"customer");
              p.add('pageNumber',0);
      		    p.add('pageSize',0);
      		    p.add('orderBys',"9");
      		    var items = new Array();
              SOAPClient.invoke(url1, "getWlCustomerByStatusAndSort", p, false,  function GetEnu_callBack(ul, soapResponse){   
                     //querydata=new Array();        
                     for(var i = 0; i < ul.length; i++){		
                       var ulo=ul[i];
                       //custStores =custStores + '<option value="'+ulo["ns:id"]+'">'+ulo["ns:customerName"]+'</option>';
                       items.push({name: ulo["ns:customerName"], value:ulo["ns:id"],linkMan:ulo["ns:linkman"],address:ulo["ns:address"],tel:ulo["ns:tel"]});
                     }        
                      
               });       // var items = new Array();
          var custStore = new dojo.data.ItemFileWriteStore({data: {identifier:"value", items: items}});      
        //-----------------------   
        function custNameSet(id,value){
        	var itemselect=custStore._getItemByIdentity(value);
        	//alert("itemselect:"+itemselect);
        	if(itemselect!='undefined'&& itemselect!=null){
        	//alert(document.getElementById("fetchCompanyNameAdd").value);
        	if(document.getElementById("fetchCompanyNameAdd").value==''){//dijit.byId("fetchCompanyNameAdd").setDisplayedValue(itemselect["name"]);
        	dijit.byId("fetchCompanyNameAdd").setValue(itemselect["value"]);}
        	if(document.getElementById("linkManAdd").value=='')document.getElementById("linkManAdd").value=itemselect["linkMan"];
        	if(document.getElementById("telAdd").value=='')document.getElementById("telAdd").value=itemselect["tel"];
        	if(document.getElementById("fetchManAdd").value=='')document.getElementById("fetchManAdd").value=itemselect["linkMan"];
        	if(document.getElementById("fetchTelAdd").value=='')document.getElementById("fetchTelAdd").value=itemselect["tel"];
        	if(document.getElementById("fetchCompanyAddressAdd").value=='')document.getElementById("fetchCompanyAddressAdd").value=itemselect["address"];
        	}
        }
        //----------------------- 
        var url2 = getUrl()+ "services/BasicManageService";        
              var p2 = new SOAPClientParameters();
              p2.add('eType','conveyance');
               //var convStores =''; 
              var items2 = new Array();
                    SOAPClient.invoke(url2, "getEnumerationByType", p2, false,  function GetEnu_callBack(ul, soapResponse){   
                    for(var i = 0; i < ul.length; i++){		
                      
                      var ulo=ul[i];
                      //convStores =convStores + '<option value="'+ulo["ns:id"]+'">'+ulo["ns:fieldName"]+'</option>';
                      //items2.push({name: ulo["ns:fieldName"], value:ulo["ns:id"]});
                      items2.push({name: ulo["ns:fieldName"], value:ulo["ns:fieldName"]});
                    }                
                });       
             
             var convStore = new dojo.data.ItemFileWriteStore({data: {identifier:"value", items: items2}});      
              

         //------------------------
            var p3 = new SOAPClientParameters();
              p3.add('eType','wllevel');
              var items3 = new Array();
              //var levelStores='';
                    SOAPClient.invoke(url2, "getEnumerationByType", p3, false,  function GetEnu_callBack(ul, soapResponse){   
                    for(var i = 0; i < ul.length; i++){		
                      var ulo=ul[i];
                      //levelStores =levelStores + '<option value="'+ulo["ns:id"]+'">'+ulo["ns:fieldName"]+'</option>';
                      //items3.push({name: ulo["ns:fieldName"], value:ulo["ns:id"]});
                      items3.push({name: ulo["ns:fieldName"], value:ulo["ns:fieldName"]});
                    }                
                });       
              var levelStore = new dojo.data.ItemFileWriteStore({data: {identifier:"value", items: items3}});        
         //------------------------
            var p4 = new SOAPClientParameters();
              p4.add('eType','carryType');
              var items4 = new Array();
              //var carryTypeStores ='';
                    SOAPClient.invoke(url2, "getEnumerationByType", p4, false,  function GetEnu_callBack(ul, soapResponse){   
                    for(var i = 0; i < ul.length; i++){		
                      var ulo=ul[i];
                      //carryTypeStores=carryTypeStores+'<option value="'+ulo["ns:id"]+'">'+ulo["ns:fieldName"]+'</option>';
                      //items4.push({name: ulo["ns:fieldName"], value:ulo["ns:id"]}); 
                      items4.push({name: ulo["ns:fieldName"], value:ulo["ns:fieldName"]}); 
                    }                
                });       
              var carryTypeStore = new dojo.data.ItemFileWriteStore({data: {identifier:"value", items: items4}});
         //------------------------
            var p5 = new SOAPClientParameters();
            var items5 = new Array();  
            //var pathStores ='';
                    SOAPClient.invoke(url2, "getAllPathvo", p5, false,  function GetEnu_callBack(ul, soapResponse){   
                    for(var i = 0; i < ul.length; i++){		
                      var ulo=ul[i];
                       //pathStores=pathStores+'<option value="'+ulo["ns:id"]+'">'+ulo["ns:pathName"]+'</option>';
                      items5.push({name: ulo["ns:pathName"], value:ulo["ns:id"]});
                    }                
                });       
             var pathStore = new dojo.data.ItemFileWriteStore({data: {identifier:"value", items: items5}});
             
        function custFetchSet(id,value){
        //alert("id:"+id);
       // alert("value:"+value);
        	var itemselect=custStore._getItemByIdentity(value);
        	if(itemselect!='undefined'&& itemselect!=null){
        	if(document.getElementById("fetchManAdd").value=='')document.getElementById("fetchManAdd").value=itemselect["linkMan"];
        	if(document.getElementById("fetchTelAdd").value=='')document.getElementById("fetchTelAdd").value=itemselect["tel"];
        	if(document.getElementById("fetchCompanyAddressAdd").value=='')document.getElementById("fetchCompanyAddressAdd").value=itemselect["address"];
        	}
        }
         //----------------------- 
         function custUnloadSet(id,value){
        	var itemselect=custStore._getItemByIdentity(value);
        	if(itemselect!='undefined'&& itemselect!=null){
        	if(document.getElementById("unloadManAdd").value=='')document.getElementById("unloadManAdd").value=itemselect["linkMan"];
        	if(document.getElementById("unloadTelAdd").value=='')document.getElementById("unloadTelAdd").value=itemselect["tel"];
        	if(document.getElementById("unloadCompanyAddressAdd").value=='')document.getElementById("unloadCompanyAddressAdd").value=itemselect["address"];
          }
        }
         //----------------------- 

         
    var modelSub = new dojox.grid.data.Table(null, gridSubdata);

          
  

               
  function getOrderRowVO(queryOrderRowvo,pagenumber,pagesize,orderBy){

      var pu = new SOAPClientParameters2();
      pu.add('WlOrderRowVO',queryOrderRowvo) ;
      pu.add('pageNumber',pagenumber) ;
	    pu.add('pageSize',pagesize) ;
	    pu.add('orderBy',orderBy) ;
      SOAPClient.invoke(url,"getWlOrderRow", pu, false,  function GetEnu_callBack(ul, soapResponse){      
           querydata=WlOrderRowVOtoArray_fun(ul,false);
           totalCount=ul[ul.length-1]["ns:id"]; 
           totalpage=Math.ceil(new Number(totalCount)/pagesize);
           document.getElementById("rowCount").innerHTML=" "+pagenumber+" / "+totalpage+" / "+totalCount+" " ;
      }); 
      querydata.splice(querydata.length-1,1);
      model.setData(querydata);
      //dijit.byId("grid").updateRowCount(querydata.length); 
 }
 
           
          
         //---------------------         
   function call_funUpd() {
   			var padd = new SOAPClientParameters2();
             var vobject=new WlOrderVO();
              var  d=new DateTimeQuery();
              var n=new NumberQuery();
             vobject.id=document.getElementById('orderId').value;
             vobject.customerOrderNo=document.getElementById("customerOrderNoAdd").value;
             vobject.contractNo=document.getElementById("contractNoAdd").value;
             if(dojox.validate.isText(document.getElementById("conveyanceAdd").value, {minlength: 1})){vobject.conveyance=document.getElementById("conveyanceAdd").value;
             }else{alert("not null");}//not null
             vobject.carryType=document.getElementById("carryTypeAdd").value;
             vobject.shipperRemark=document.getElementById("shipperRemarkAdd").value;
             vobject.carrierRemark="carrierRemark";
             vobject.wllevel=document.getElementById("levelAdd").value;
             var tt=document.getElementsByName("customerTypeAdd");
              for(var i in tt){
                 if(tt[i].checked)  vobject.customerType=tt[i].value;
              }
            if(dojox.validate.isText(document.getElementById("referTimeAdd1").value, {minlength: 1})){
            //vobject.referTime=document.getElementById("referTimeAdd1").value+" "+document.getElementById("referTimeAdd2").value;
            var  d=new DateTimeQuery();
            d.upDate=document.getElementById("referTimeAdd1").value+" "+document.getElementById("referTimeAdd2").value;
            vobject.referTime=d;
             }else{}//not null
             vobject.linkMan=document.getElementById("linkManAdd").value;
             vobject.tel=document.getElementById("telAdd").value;
             vobject.bookTime=d;
             //dojo.date.locale.format(new Date(),{ datePattern: "yyyy-MM-dd", timePattern: "HH:mm"});
             vobject.completeTime=d;
             //dojo.date.locale.format(new Date(),{ datePattern: "yyyy-MM-dd", timePattern: "HH:mm"});//is null
             vobject.formState='0';
             d=new DateTimeQuery();
             d.upDate=document.getElementById("planFetchTimeAdd1").value+" "+document.getElementById("planFetchTimeAdd2").value;
             vobject.planFetchTime=d;
             //vobject.planFetchTime=document.getElementById("planFetchTimeAdd1").value+" "+document.getElementById("planFetchTimeAdd2").value;
             vobject.fetchCompanyID = dijit.byId("fetchCompanyNameAdd").getValue();
             vobject.fetchCompanyName=dijit.byId("fetchCompanyNameAdd").getDisplayedValue();
             vobject.fetchCompanyAddress=document.getElementById("fetchCompanyAddressAdd").value;
             vobject.fetchMan=document.getElementById("fetchManAdd").value;
             vobject.fetchTel=document.getElementById("fetchTelAdd").value;
             d=new DateTimeQuery();
             d.upDate=document.getElementById("planUnloadTimeAdd1").value+" "+document.getElementById("planUnloadTimeAdd2").value;
            vobject.planUnloadTime=d;
            // vobject.planUnloadTime=document.getElementById("planUnloadTimeAdd1").value+" "+document.getElementById("planUnloadTimeAdd2").value;
             vobject.unloadCompanyID = dijit.byId("unloadCompanyNameAdd").getValue();
             vobject.unloadCompanyName=dijit.byId("unloadCompanyNameAdd").getDisplayedValue();
             vobject.unloadCompanyAddress=document.getElementById("unloadCompanyAddressAdd").value;
             vobject.unloadMan=document.getElementById("unloadManAdd").value;
             vobject.unloadTel=document.getElementById("unloadTelAdd").value;
             vobject.remark=document.getElementById("remarkAdd").value;
             vobject.pathName=dijit.byId("pathAdd").getDisplayedValue();
             vobject.pathid=dijit.byId("pathAdd").getValue();
              vobject.payCompanyID = 1;
              vobject.payCompany = 'payCompany';
              vobject.customerID = dijit.byId("customerNameAdd").getValue();;
              vobject.customer = dijit.byId("customerNameAdd").getDisplayedValue();
              vobject.bookerId = 1;
              vobject.operatorId = 1;
              vobject.taskPeopleId = 1;
              var orderrow;
             if(vobject.id==0){//create new row
                padd.add('WlOrderVO',vobject);
                SOAPClient.invoke(url, "createWlOrder", padd, false,  function GetEnu_callBack(ul, soapResponse){
                document.getElementById('orderId').value=ul;
                //querydata.push([true,ul,vobject.customerOrderNo,vobject.contractNo,vobject.conveyance,vobject.carryType,vobject.shipperRemark,vobject.carrierRemark,vobject.wllevel,vobject.customerType,vobject.referTime,vobject.linkMan,vobject.tel,vobject.bookTime,vobject.completeTime,vobject.formState,vobject.planFetchTime,vobject.fetchCompanyName,vobject.fetchCompanyAddress,vobject.fetchMan,vobject.fetchTel,vobject.planUnloadTime,vobject.unloadCompanyName,vobject.unloadCompanyAddress,vobject.unloadMan,vobject.unloadTel,vobject.remark,vobject.customer,vobject.pathName,vobject.fetchCompanyID,vobject.unloadCompanyID,vobject.pathid,vobject.customerID,[new WlOrderRowVO()]]);
                //\u5f53VioualGrid\uff0c\u5229\u7528get\u65b9\u6cd5\u76f4\u63a5\u4ece\u6570\u7ec4\u4e2d\u83b7\u5f97\u6570\u636e\u65f6\uff0c\u589e\u52a0\u8bb0\u5f55\uff0c\u5fc5\u987b\u540c\u65f6\u4fee\u6539\u6570\u7ec4\u548caddRow\uff01
                //(\u539f\u56e0\u5728\u4e8e\u6ca1\u6709\u5148addRow\uff0c\u5e76\u5728grid\u4e2d\u4fee\u6539?!!!!\u8bd5\u8bd5\u624d\u77e5\u9053)
                querydata.push([false,ul,vobject.customerOrderNo,
                vobject.contractNo,vobject.conveyance,vobject.carryType,vobject.shipperRemark,vobject.carrierRemark,vobject.wllevel,
                vobject.customerType,vobject.referTime.upDate,vobject.referTime.upDate,vobject.linkMan,vobject.tel,vobject.bookTime.upDate,vobject.bookTime.upDate
                ,vobject.completeTime.upDate,vobject.completeTime.upDate,vobject.formState,vobject.planFetchTime.upDate,vobject.planFetchTime.upDate              
                 ,vobject.fetchCompanyName,vobject.fetchCompanyAddress,vobject.fetchMan,vobject.fetchTel,vobject.planUnloadTime.upDate,vobject.planUnloadTime.upDate
                 ,vobject.unloadCompanyName,vobject.unloadCompanyAddress,vobject.unloadMan,vobject.unloadTel,vobject.remark,new WlOrderRowVO(),vobject.payCompany
                 ,vobject.fetchCompany,vobject.unloadCompany,vobject.customer,vobject.booker,vobject.wloperator,vobject.taskPeople,vobject.pathid
                 ,vobject.customerID,vobject.fetchCompanyID,vobject.unloadCompanyID,vobject.pathName]);
                dijit.byId("grid").addRow(querydata[document.getElementById('erowIndex').value]); 
               
                totalCount++;
                var totalpage=Math.ceil(new Number(totalCount)/pagesize);
                //document.getElementById("rowCount").innerHTML="\u7b2c"+pagenumber+"\u9875/\u5171"+totalpage+"\u9875/\u603b\u8ba1"+totalCount+"\u6761\u8bb0\u5f55" ; 
                });
	         }else{//modify row
                padd.add('WlOrderVO',vobject);
                SOAPClient.invoke(url, "updateWlOrder", padd, false,  function GetEnu_callBack(ul, soapResponse){
                //\u4e5f\u4e0d\u80fd\u81ea\u52a8\u540c\u6b65\uff01
                orderrow=querydata[document.getElementById('erowIndex').value][32];
                querydata[document.getElementById('erowIndex').value]=[false,vobject.id,vobject.customerOrderNo,
                vobject.contractNo,vobject.conveyance,vobject.carryType,vobject.shipperRemark,vobject.carrierRemark,vobject.wllevel,
                vobject.customerType,vobject.referTime.upDate,vobject.referTime.upDate,vobject.linkMan,vobject.tel,vobject.bookTime.upDate,vobject.bookTime.upDate
                ,vobject.completeTime.upDate,vobject.completeTime.upDate,vobject.formState,vobject.planFetchTime.upDate,vobject.planFetchTime.upDate              
                 ,vobject.fetchCompanyName,vobject.fetchCompanyAddress,vobject.fetchMan,vobject.fetchTel,vobject.planUnloadTime.upDate,vobject.planUnloadTime.upDate
                 ,vobject.unloadCompanyName,vobject.unloadCompanyAddress,vobject.unloadMan,vobject.unloadTel,vobject.remark,orderrow,vobject.payCompany
                 ,vobject.fetchCompany,vobject.unloadCompany,vobject.customer,vobject.booker,vobject.wloperator,vobject.taskPeople,vobject.pathid
                 ,vobject.customerID,vobject.fetchCompanyID,vobject.unloadCompanyID,vobject.pathName];
                //[true,vobject.id,vobject.customerOrderNo,vobject.contractNo,vobject.conveyance,vobject.carryType,vobject.shipperRemark,vobject.carrierRemark,vobject.wllevel,vobject.customerType,vobject.referTime,vobject.linkMan,vobject.tel,vobject.bookTime,vobject.completeTime,vobject.formState,vobject.planFetchTime,vobject.fetchCompanyName,vobject.fetchCompanyAddress,vobject.fetchMan,vobject.fetchTel,vobject.planUnloadTime,vobject.unloadCompanyName,vobject.unloadCompanyAddress,vobject.unloadMan,vobject.unloadTel,vobject.remark,vobject.customer,vobject.pathName,vobject.fetchCompanyID,vobject.unloadCompanyID,vobject.pathid,vobject.customerID,orderrow];
              //  
                });
	         }
	         //updateSub\u90fd\u53ef\u4ee5\u81ea\u52a8\u540c\u6b65!\u5982\u4f55\u5b9e\u73b0\u7684
           	      //for(var i=0;i<gridSub.model.getRowCount()-1;i++){//\u53bb\u6389\u5408\u8ba1\u884c
        for(var i=0;i<gridSub.model.getRowCount();i++){
	           var passAll=0;
	           var n=new NumberQuery();
             var thisCell=gridSub.model.data[i];
             var paddSub = new SOAPClientParameters2();
             var vobjectSub=new WlOrderRowVO();
             vobjectSub.id=thisCell[1];
             vobjectSub.productCode=thisCell[2];
             vobjectSub.productName=thisCell[3];
             vobjectSub.productEquType=thisCell[4];
             
               
             if(dojox.validate.isText(thisCell[5], {minlength: 1})){vobjectSub.measureUnit=thisCell[5];
             }else{gridSub.getCell(5).getNode(i).innerHTML="<span style={color:red;line-height:16px}>can not be null</span>";passAll=1; }//not null
              if(dojox.validate.isInRange(thisCell[6],{max:9999999, min:0})){
              var  n=new NumberQuery(); n.upNumber=thisCell[6];vobjectSub.productNum=n;
             }else{grid.getCell(6).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double

             if(dojox.validate.isInRange(thisCell[7],{max:9999999, min:0})){
              var  n=new NumberQuery(); n.upNumber=thisCell[7];
                vobjectSub.unitNum=n;
             }else{grid.getCell(7).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double

             if(dojox.validate.isInRange(thisCell[8],{max:9999999, min:0})){
              var  n=new NumberQuery(); n.upNumber=thisCell[8];vobjectSub.goodsSuttle=n;
             }else{grid.getCell(8).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double

             if(dojox.validate.isInRange(thisCell[9],{max:9999999, min:0})){
              var  n=new NumberQuery(); n.upNumber=thisCell[9];vobjectSub.goodsWeight=n;
             }else{grid.getCell(9).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double

             if(dojox.validate.isInRange(thisCell[10],{max:9999999, min:0})){
              var  n=new NumberQuery(); n.upNumber=thisCell[10];vobjectSub.goodsVolume=n;
             }else{grid.getCell(10).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double

               vobjectSub.label=thisCell[11];
              if(dojox.validate.isInRange(thisCell[12],{max:9999999, min:0})){
               var n=new NumberQuery(); n.upNumber=thisCell[12];vobjectSub.carriage=n;
             }else{grid.getCell(12).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double
             vobjectSub.especial=thisCell[13];
             vobjectSub.goodsState=thisCell[14];
             vobjectSub.status='0';
             vobjectSub.version=0;
             vobjectSub.remark=thisCell[15];
             vobjectSub.wlOrderid =document.getElementById('orderId').value;
             vobjectSub.productID=1;
         if(passAll==0){
             if(thisCell[1]==0){//create new row
                paddSub.add('WlOrderRowVO',vobjectSub);
                SOAPClient.invoke(url, "createWlOrderRow", paddSub, false,  function GetEnu_callBack(ul, soapResponse){
                gridSub.model.setDatum(ul,i,1);
                vobjectSub.id=ul;
                //grid\u5982\u4f55\u5b9e\u73b0\u4e86\u81ea\u52a8\u540c\u6b65\uff1f\uff1f\uff1f\uff1f\uff1f\uff1f\uff1f
                                /*var orderRowvo= querydata[document.getElementById('erowIndex').value][32];
                alert("orderRowvo.length:"+orderRowvo.length);
                orderRowvo[orderRowvo.length]=orderRowVOtoArray_fun(vobjectSub);
                querydata[document.getElementById('erowIndex').value][32]=orderRowvo;
                alert("orderRowvo.length:::::"+orderRowvo.length);*/
                //dijit.byId("grid").updateRow(document.getElementById('erowIndex').value);
                });
	         }else{//modify row
                paddSub.add('WlOrderRowVO',vobjectSub);
                SOAPClient.invoke(url, "updateWlOrderRow", paddSub, false,  function GetEnu_callBack(ul, soapResponse){
                /*var orderRowvo=querydata[document.getElementById('erowIndex').value][32];
                orderRowvo[i]=orderRowVOAddNS_fun(vobjectSub);
                querydata[document.getElementById('erowIndex').value][32]=orderRowvo;*/
                //dijit.byId("grid").updateRow(document.getElementById('erowIndex').value);
                });
	         }
        }
      }
      //alert("querydata[document.getElementById('erowIndex').value][32]:"+querydata[document.getElementById('erowIndex').value][32].length);
      dijit.byId("grid").updateRow(document.getElementById('erowIndex').value); 
      //  alert("fdfds:"+querydata[document.getElementById('erowIndex').value][32].length);
      //\u5220\u9664orderRow
      for(var i=0;i<deletedataSub.length;i++){
               var pdel = new SOAPClientParameters();      
               pdel.add('id',deletedataSub[i]);
               SOAPClient.invoke(url, "deleteWlOrderRow", pdel, false,  function GetEnu_callBack(ul, soapResponse){
	             
	           });
          }
          deletedataSub=new Array();
      
      
    }
    
    deleteSub= function(){
           var s = gridSub.selection.getSelected();
           for(var i=0;i<s.length;i++){ 
             var ii=s[i];
             var thisCell=gridSub.model.data[ii];      
             if(thisCell[1]!=0){//the row which will be deleted
                deletedataSub.splice(deletedataSub.length,0,thisCell[1]);
              }
           }    
        gridSub.removeSelectedRows();
     } 
     
     function removeSelectedRowsGrid(){
     if(window.confirm("?")){
        var s = dijit.byId("grid").selection.getSelected();
        
        
        for(var i=0;i<s.length;i++){ 
              var ii=s[i];
              var si=document.getElementById('erowIndex').value;
              var pdel = new SOAPClientParameters();      
               pdel.add('id',querydata[ii][1]);
               SOAPClient.invoke(url, "deleteWlOrder", pdel, false,  function GetEnu_callBack(ul, soapResponse){
               if(si>ii)document.getElementById('erowIndex').value=si-1;
               totalCount--;
               var totalpage=Math.ceil(new Number(totalCount)/pagesize);
               document.getElementById("rowCount").innerHTML="\u7b2c"+pagenumber+"\u9875/\u5171"+totalpage+"\u9875/\u603b\u8ba1"+totalCount+"\u6761\u8bb0\u5f55" ; 
               if(si=ii){if(document.getElementById('addDiv').style.display=='')document.getElementById('addDiv').style.display='none';}
	        });   
          }             
           dijit.byId("grid").removeSelectedRows();
      }
     }    
     //init
  
  function getOrderVO(queryvo,pagenumber,pagesize,orderBy){

      var pu = new SOAPClientParameters2();
      pu.add('WlOrderVO',queryvo) ;
      pu.add('pageNumber',pagenumber) ;
	    pu.add('pageSize',pagesize) ;
	    pu.add('orderBy',orderBy) ;
      SOAPClient.invoke(url,"getWlOrder", pu, false,  function GetEnu_callBack(ul, soapResponse){      
           querydata=WlOrderVOtoArray_fun(ul,false);
           totalCount=ul[ul.length-1]["ns:id"]; 
           totalpage=Math.ceil(new Number(totalCount)/pagesize);
           document.getElementById("rowCount").innerHTML=" "+pagenumber+" / "+totalpage+" / "+totalCount+" " ;
      }); 
      querydata.splice(querydata.length-1,1);
      dojo.contentBox(dijit.byId("grid").domNode, {w: 1260, h: 800});
      dijit.byId("grid").updateRowCount(querydata.length);
  }
      function init(){
      //alert("1111");
      var grid = new dojox.VirtualGrid({
					title: "rab1",
					id: "grid",
					jsId: "grid",
					structure: layout,
					//styles:"{height:800;width:98%;left:1}",
					rowCount:0
				}, dojo.byId("grid")); 
				queryvo=new WlOrderVO();
        getOrderVO(queryvo,pagenumber,pagesize,'0');
      
      
     /* dojo.connect(gridSub, "onSelected", function(inRowIndex){
      
          //gridSubdata[gridSubdata.length]=[]
           var s = gridSub.selection.getSelected();
           gridSubdata=getSumRow(gridSubdata,s,false);
           gridSub.updateRow(gridSubdata.length-1);
      });
      
       dojo.connect(gridSub, "onDeselected", function(inRowIndex){
          //gridSubdata[gridSubdata.length]=[]
           var s = gridSub.selection.getSelected();
        if(s.length!=0){
          gridSubdata=getSumRow(gridSubdata,s,false);
        }else{
          gridSubdata=getSumRow(gridSubdata,null,false);
           //gridSubdata[gridSubdata.length]=["",0,"\u5408\u8ba1","","","",sumproductNum,"",sumgoodsSuttle,sumgoodsWeight,sumgoodsVolume,"",sumcarriage,"","","","",""];
        }
          gridSub.updateRow(gridSubdata.length-1);
      });*/
      
      function getSumRow(data,arry,add){//\u83b7\u5f97\u5408\u8ba1\u884c \uff0carry\u4e3anull\u65f6\uff0c\u5c31\u662f\u83b7\u5f97data\u4e2d\u6240\u6709\u5217\u7684\u5408\u8ba1,add\u4e3atrue\u662f\u589e\u52a0\u5408\u8ba1\u884c\uff0c\u4e3afalse\u662f\u4fee\u6539\u5408\u8ba1\u884c
          var sumproductNumS=new Number(0.0), sumgoodsSuttleS=new Number(0.0),sumgoodsWeightS=new Number(0.0),sumgoodsVolumeS=new Number(0.0),sumcarriageS=new Number(0.0);
          if(arry==null){
             for(var i=0;i<data.length;i++){ 
               sumproductNumS = sumproductNumS +new Number(data[i][6]);
               sumgoodsSuttleS = sumgoodsSuttleS+new Number(data[i][8]);
               sumgoodsWeightS = sumgoodsWeightS+new Number(data[i][9]);
               sumgoodsVolumeS = sumgoodsVolumeS+new Number(data[i][10]);
               sumcarriageS = sumcarriageS+new Number(data[i][12]);
               }
          }else{ var ii;
            for(var i=0;i<arry.length;i++){ 
               ii=arry[i];
               sumproductNumS = sumproductNumS +new Number(data[ii][6]);
               sumgoodsSuttleS = sumgoodsSuttleS+new Number(data[ii][8]);
               sumgoodsWeightS = sumgoodsWeightS+new Number(data[ii][9]);
               sumgoodsVolumeS = sumgoodsVolumeS+new Number(data[ii][10]);
               sumcarriageS = sumcarriageS+new Number(data[ii][12]);
               }
          }
          if(add){
          data[data.length]=["",0,"\u5408\u8ba1","","","",sumproductNumS,"",sumgoodsSuttleS,sumgoodsWeightS,sumgoodsVolumeS,"",sumcarriageS,"","","","",""];
          }else{
          data[data.length-1]=["",0,"\u5408\u8ba1","","","",sumproductNumS,"",sumgoodsSuttleS,sumgoodsWeightS,sumgoodsVolumeS,"",sumcarriageS,"","","","",""];
          }
          return data;
      }
      
      
      
     
         addRow = function(){
         if(document.getElementById('queryDiv').style.display=='')document.getElementById('queryDiv').style.display='none';
         if(document.getElementById('addDiv').style.display=='none')document.getElementById('addDiv').style.display='';
         dijit.byId("but1").setDisabled(false);
         dijit.byId("but2").setDisabled(false);
         dijit.byId("but3").setDisabled(false);
         dijit.byId("but4").setDisabled(false);
         
         
          //querydisplay('addDiv');
          //\u6e05\u7a7aadd\u754c\u9762
          //alert(qyerydata.length);
             document.getElementById('erowIndex').value=querydata.length;
             document.getElementById('orderId').value='';
             document.getElementById("customerOrderNoAdd").value='';
             document.getElementById("contractNoAdd").value='';
             document.getElementById("conveyanceAdd").value='';
             document.getElementById("carryTypeAdd").value='';
             document.getElementById("shipperRemarkAdd").value='';
             document.getElementById("levelAdd").value='';
             document.getElementById("linkManAdd").value='';
             document.getElementById("telAdd").value='';
             document.getElementById("planFetchTimeAdd1").value='';
             document.getElementById("planFetchTimeAdd2").value='';
             dijit.byId("fetchCompanyNameAdd").setValue('');
             dijit.byId("fetchCompanyNameAdd").setDisplayedValue('');
             document.getElementById("fetchCompanyAddressAdd").value='';
             document.getElementById("fetchManAdd").value='';
             document.getElementById("fetchTelAdd").value='';
             document.getElementById("planUnloadTimeAdd1").value='';
             document.getElementById("planUnloadTimeAdd2").value='';
             dijit.byId("unloadCompanyNameAdd").setValue('');
             dijit.byId("unloadCompanyNameAdd").setDisplayedValue('');
             document.getElementById("unloadCompanyAddressAdd").value='';
             document.getElementById("unloadManAdd").value='';
             document.getElementById("unloadTelAdd").value='';
             document.getElementById("remarkAdd").value='';
             dijit.byId("pathAdd").setDisplayedValue('');
             dijit.byId("pathAdd").setValue('');
             dijit.byId("customerNameAdd").setValue('');
             dijit.byId("customerNameAdd").setDisplayedValue('');   
	        document.getElementById('orderId').value='0';
	        document.getElementById('referTimeAdd1').value=dojo.date.locale.format(new Date(),{ datePattern: "yyyy-MM-dd", selector: "date"});
	        document.getElementById('referTimeAdd2').value=dojo.date.locale.format(new Date(),{ timePattern: "HH:mm", selector: "time"});
	        //gridSub.edit.cancel();
           //modelSub.setData(null);
	         modelSub.clearData(true);
	         //gridSub.update();
	         gridSub.updateRowCount(0);
	        
	       } 
      hiddenbut= function(){
               if(document.getElementById('addDiv').style.display==''){
               dojo.byId('addDiv').style.display='none';
               dijit.byId("but1").setDisabled(true);
               dijit.byId("but2").setDisabled(true);
               dijit.byId("but3").setDisabled(true);
               dijit.byId("but4").setDisabled(true);
               
               }
               
      }	       
	       
	        //init
       addRowSub = function(){
       
               gridSub.addRow([false,0,"","","","","","","","","","","","","","","","","",""],gridSub.model.getRowCount());
       }
      querydis= function(){
               if(document.getElementById('addDiv').style.display=='')document.getElementById('addDiv').style.display='none';
               querydisplay("queryDiv");
       } 
     
 document.getElementById('addDiv').style.display='none';
     	  dojo.connect(dijit.byId("grid"), "dodblclick", function(e){
       //dojo.connect(dijit.byId("grid"), "onRowDblClick", function(e){
       if(document.getElementById('queryDiv').style.display=='')document.getElementById('queryDiv').style.display='none';
       if(document.getElementById('addDiv').style.display=='none')document.getElementById('addDiv').style.display='';
         dijit.byId("but1").setDisabled(false);
         dijit.byId("but2").setDisabled(false);
         dijit.byId("but3").setDisabled(false);
         dijit.byId("but4").setDisabled(false);
         document.getElementById('erowIndex').value=e.rowIndex;
         document.getElementById('orderId').value=querydata[e.rowIndex][1];
         
        // dijit.byId("customerNameAdd").setDisplayedValue(querydata[e.rowIndex][36]);
         dijit.byId("customerNameAdd").setValue(querydata[e.rowIndex][41]);
         document.getElementById("linkManAdd").value=querydata[e.rowIndex][11];
         document.getElementById("telAdd").value=querydata[e.rowIndex][12];
         document.getElementById("customerOrderNoAdd").value=querydata[e.rowIndex][2];
         document.getElementById("contractNoAdd").value=querydata[e.rowIndex][3];
         document.getElementById("conveyanceAdd").value=querydata[e.rowIndex][4];
         document.getElementById("carryTypeAdd").value=querydata[e.rowIndex][5];
         document.getElementById("shipperRemarkAdd").value=querydata[e.rowIndex][6];
         document.getElementById("levelAdd").value=querydata[e.rowIndex][8];
         document.getElementById("planFetchTimeAdd1").value=querydata[e.rowIndex][19].substring(0,10);
         //querydata[e.rowIndex][19].substring(0,10);//
         document.getElementById("planFetchTimeAdd2").value=querydata[e.rowIndex][20].substring(11,16);
         //querydata[e.rowIndex][16].substring(11,16);
         dijit.byId("fetchCompanyNameAdd").setValue(querydata[e.rowIndex][42]);
         //\u662f\u5426\u5141\u8bb8\u7528\u6237\u76f4\u63a5\u8f93\u5165\u4e0b\u62c9\u9009\u9879\u4e2d\u6ca1\u6709\u7684\u5ba2\u6237\u5462\uff1f\u5141\u8bb8.\u6b64\u65f6ID\u4e3a\u7a7a
         //dijit.byId("fetchCompanyNameAdd").setDisplayedValue(querydata[e.rowIndex][21]);
         document.getElementById("fetchCompanyAddressAdd").value=querydata[e.rowIndex][22];
         document.getElementById("fetchManAdd").value=querydata[e.rowIndex][23];
         document.getElementById("fetchTelAdd").value=querydata[e.rowIndex][24];
         //
         document.getElementById("planUnloadTimeAdd1").value=querydata[e.rowIndex][25].substring(0,10);
         document.getElementById("planUnloadTimeAdd2").value=querydata[e.rowIndex][26].substring(11,16);
         dijit.byId("unloadCompanyNameAdd").setValue(querydata[e.rowIndex][43]);
         //dijit.byId("unloadCompanyNameAdd").setDisplayedValue(querydata[e.rowIndex][27]);
         document.getElementById("unloadCompanyAddressAdd").value=querydata[e.rowIndex][28];
         document.getElementById("unloadManAdd").value=querydata[e.rowIndex][29];
         document.getElementById("unloadTelAdd").value=querydata[e.rowIndex][30];
         document.getElementById("remarkAdd").value=querydata[e.rowIndex][31];
         //dijit.byId("pathAdd").setDisplayedValue(querydata[e.rowIndex][28]);
         dijit.byId("pathAdd").setValue(querydata[e.rowIndex][40]);//\u5fc5\u987b\u9009\u62e9
                
         document.getElementById('referTimeAdd1').value=querydata[e.rowIndex][10].substring(0,10);
         document.getElementById('referTimeAdd2').value=querydata[e.rowIndex][11].substring(11,16);
        
           //gridSubdata=orderRowVOtoArray_fun(querydata[e.rowIndex][33]);
	           gridSubdata=querydata[e.rowIndex][32];
	           //alert(gridSubdata);
	           //gridSub.edit.cancel();
	           modelSub.setData(gridSubdata);
	           //modelSub.setData(getSumRow(gridSubdata,null,true));
	           //modelSub.setData(getRowDate(querydata[e.rowIndex][1]));
	           //gridSub.update();
	            gridSub.updateRowCount(gridSubdata.length);
	            //gridSub.edit.cancel();
	           
	        
       });   
      } 
     
            
         dojo.addOnLoad(init);
  //query
         
function querybutton(){
         var d,n;
              var validstate=0;
              //queryvo.id=0 ;
              queryvo=new WlOrderVO();
              if(querycustomerOrderNo.getDisplayedValue()!="")queryvo.customerOrderNo=querycustomerOrderNo.getDisplayedValue();//
              if(querycontractNo.getDisplayedValue()!="")queryvo.contractNo=querycontractNo.getDisplayedValue();//
              if(queryconveyance.getDisplayedValue()!="")queryvo.conveyance=queryconveyance.getDisplayedValue();//
              if(querycarryType.getDisplayedValue()!="")queryvo.carryType=querycarryType.getDisplayedValue();//
              if(queryshipperRemark.getDisplayedValue()!="")queryvo.shipperRemark=queryshipperRemark.getDisplayedValue();//
              if(querycarrierRemark.getDisplayedValue()!="")queryvo.carrierRemark=querycarrierRemark.getDisplayedValue();//
              if(querywllevel.getDisplayedValue()!="")queryvo.wllevel=querywllevel.getDisplayedValue();//
              if(querycustomerType.getDisplayedValue()!="")queryvo.customerType=querycustomerType.getDisplayedValue();//
              d=queryDate_fun("referTime");
              if(d==null){validstate=1;}else if(d.upSign!="%"){queryvo.referTime=d;}
              if(querylinkMan.getDisplayedValue()!="")queryvo.linkMan=querylinkMan.getDisplayedValue();//
              if(querytel.getDisplayedValue()!="")queryvo.tel=querytel.getDisplayedValue();//
              d=queryDate_fun("bookTime");
              if(d==null){validstate=1;}else if(d.upSign!="%"){queryvo.bookTime=d;}
              d=queryDate_fun("completeTime");
              if(d==null){validstate=1;}else if(d.upSign!="%"){queryvo.completeTime=d;}
              if(queryformState.getDisplayedValue()!="")queryvo.formState=queryformState.getDisplayedValue();//
              d=queryDate_fun("planFetchTime");
              if(d==null){validstate=1;}else if(d.upSign!="%"){queryvo.planFetchTime=d;}
              if(queryfetchCompanyName.getDisplayedValue()!="")queryvo.fetchCompanyName=queryfetchCompanyName.getDisplayedValue();//
              if(queryfetchCompanyAddress.getDisplayedValue()!="")queryvo.fetchCompanyAddress=queryfetchCompanyAddress.getDisplayedValue();//
              if(queryfetchMan.getDisplayedValue()!="")queryvo.fetchMan=queryfetchMan.getDisplayedValue();//
              if(queryfetchTel.getDisplayedValue()!="")queryvo.fetchTel=queryfetchTel.getDisplayedValue();//
              d=queryDate_fun("planUnloadTime");
              if(d==null){validstate=1;}else if(d.upSign!="%"){queryvo.planUnloadTime=d;}
              if(queryunloadCompanyName.getDisplayedValue()!="")queryvo.unloadCompanyName=queryunloadCompanyName.getDisplayedValue();//
              if(queryunloadCompanyAddress.getDisplayedValue()!="")queryvo.unloadCompanyAddress=queryunloadCompanyAddress.getDisplayedValue();//
              if(queryunloadMan.getDisplayedValue()!="")queryvo.unloadMan=queryunloadMan.getDisplayedValue();//
              if(queryunloadTel.getDisplayedValue()!="")queryvo.unloadTel=queryunloadTel.getDisplayedValue();//
              if(queryremark.getDisplayedValue()!="")queryvo.remark=queryremark.getDisplayedValue();//
        if(validstate==0){
              pagenumber=1;
              getOrderVO(queryvo,pagenumber,pagesize,'0');
              if(totalpage>1){dijit.byId("but7").setDisabled(false);}else{dijit.byId("but7").setDisabled(true);}
             }
         }       
  function changeT(isFocused){

        var fdt=dojo.date.locale.parse(dijit.byId("planFetchTimeAdd1").getDisplayedValue()+" "+dijit.byId("planFetchTimeAdd2").getDisplayedValue(),{ datePattern: "yyyy-MM-dd", timePattern: "HH:mm"});
        var rdt=dojo.date.locale.parse(dijit.byId("referTimeAdd1").getDisplayedValue()+" "+dijit.byId("referTimeAdd2").getDisplayedValue(),{ datePattern: "yyyy-MM-dd", timePattern: "HH:mm"});
        var udt=dojo.date.locale.parse(dijit.byId("planUnloadTimeAdd1").getDisplayedValue()+" "+dijit.byId("planUnloadTimeAdd2").getDisplayedValue(),{ datePattern: "yyyy-MM-dd", timePattern: "HH:mm"});
              
       if(dijit.byId("referTimeAdd1").getValue()!=null&&dijit.byId("referTimeAdd2").getValue()&&dijit.byId("planFetchTimeAdd1").getValue()!=null&&dijit.byId("planFetchTimeAdd2").getValue()!=null){
          if(dojo.date.compare( fdt, rdt,'datetime')==-1){return false;}
         }
       if(dijit.byId("referTimeAdd1").getValue()!=null&&dijit.byId("referTimeAdd2").getValue()&&dijit.byId("planUnloadTimeAdd1").getValue()!=null&&dijit.byId("planUnloadTimeAdd2").getValue()!=null){
           if(dojo.date.compare( udt, rdt,'datetime')==-1){return false;}
         }
       if(dijit.byId("planFetchTimeAdd1").getValue()!=null&&dijit.byId("planFetchTimeAdd2").getValue()!=null&&dijit.byId("planUnloadTimeAdd1").getValue()!=null&&dijit.byId("planUnloadTimeAdd2").getValue()!=null){
           if(dojo.date.compare( udt, fdt,'datetime')==-1){return false;}
         }    
         return true;
//\u5e94\u89e6\u53d1\u6240\u6709\u5176\u4ed6\u7684\u65f6\u95f4\u63a7\u4ef6\u7684\u9a8c\u8bc1\u65b9\u6cd5
};

  function changeD(isFocused){
         //alert("m,bm,   "+dijit.byId("planFetchTimeAdd1").getValue());
         if(dijit.byId("referTimeAdd1").getValue()!=null&&dijit.byId("planFetchTimeAdd1").getValue()!=null&&dojo.date.compare( dijit.byId("planFetchTimeAdd1").getValue(), dijit.byId("referTimeAdd1").getValue(),'date')==-1){return false;}
         if(dijit.byId("referTimeAdd1").getValue()!=null&&dijit.byId("planUnloadTimeAdd1").getValue()!=null&&dojo.date.compare( dijit.byId("planUnloadTimeAdd1").getValue(), dijit.byId("referTimeAdd1").getValue(),'date')==-1){return false;}
         if(dijit.byId("planFetchTimeAdd1").getValue()!=null&&dijit.byId("planUnloadTimeAdd1").getValue()!=null&&dojo.date.compare( dijit.byId("planUnloadTimeAdd1").getValue(), dijit.byId("planFetchTimeAdd1").getValue(),'date')==-1){return false;}
      
         return true;
         }


     </script>
</head>
<body class="tundra">
    <div id="addDiv" style="margin-right: 30px;  height:50%;width:99%; " >
    <table align="center" id="0" class="editorTable"  >
       <tr align="center" >
		  <td align="right" width="100px">orderInfo:</td><td align="left" width="140px"></td> 
		  <td align="right" width="100px"><input id="orderId" style="{display:none}"  type="text"  /></td><td align="left" width="140px"></td>
		  <td align="right" width="100px">fetchInfo</td><td align="left" width="110px"></td>
		  <td align="right" width="50px"><input id="erowIndex" style="{display:none}"  type="text"  /></td><td align="left" width="130px"></td>             
          <td align="right" width="100px">unloadInfo:</td><td align="left" width="110px"></td>
          <td align="right" width="50px"></td><td align="left" width="130px"></td>
        </tr><tr align="center" >
          <td align="right" width="100px"  >customerType:</td><td align="left" width="380px" colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <input type="radio" name="customerTypeAdd" id="customerType1"  dojoType="dijit.form.RadioButton">&nbsp;&nbsp;<label for="customerType1">person</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <input type="radio" name="customerTypeAdd" id="customerType2"  value="company" dojoType="dijit.form.RadioButton" checked="checked"/>&nbsp;&nbsp;<label for="customerType2">company</label></td>
		  <td align="right" width="100px" >fName:</td><td align="left" width="290px" colspan="3"><input jsId="fetchCompanyNameAdd" id="fetchCompanyNameAdd" dojoType="dijit.form.myFilteringSelect" store="custStore" class="editerInput" required="true"  onchange="custFetchSet(0,arguments[0]);"/></td>
		  <td align="right" width="100px" >uName:</td><td align="left" width="290px" colspan="3"><input  class="editerInput" jsId="unloadCompanyNameAdd" id="unloadCompanyNameAdd"  dojoType="dijit.form.myFilteringSelect" store="custStore" onchange="custUnloadSet(0,arguments[0]);" /></td>
		</tr><tr align="center" >
          <td align="right" width="100px" >customerName:</td><td align="left" width="380px" colspan="3"><input  id="customerNameAdd"  jsId="customerNameAdd" class="editerInput" dojoType="dijit.form.myFilteringSelect" store="custStore" onchange="custNameSet(0,arguments[0]);" /></td>  
		  <td align="right" width="100px" >fAddress:</td><td align="left" width="290px" colspan="3" rowspan="2" ><textarea style="width:100%;height:42px" id="fetchCompanyAddressAdd" rows=2></textarea></td>
		  <td align="right" width="100px" >uAddress*:</td><td align="left" width="290px" colspan="3" rowspan="2" ><textarea style="width:100%;height:42px" id="unloadCompanyAddressAdd" rows=2></textarea></td>
		</tr><tr align="center" >
		  <td align="right" width="100px">*linkMan:</td><td align="left" width="140px"><input dojoType="dijit.form.TextBox"   required="true"   class="editerInput" id="linkManAdd"  /></td> 
		  <td align="right" width="100px">tel:</td><td align="left" width="140px"><input  class="editerInput" id="telAdd"   dojoType="dijit.form.TextBox"  /></td>
		  <td align="right" width="100px" ></td>
		  <td align="right" width="100px" ></td>
		
		</tr><tr align="center" >
          <td align="right" width="100px">level:</td><td align="left" width="140px"><input  id="levelAdd"  class="editerInput"  dojoType="dijit.form.FilteringSelect" store="levelStore"/></td>
          <td align="right" width="100px">path:</td> <td align="left" width="140px"><input class="editerInput" dojoType="dijit.form.FilteringSelect"  id="pathAdd" jsId="pathAdd" store="pathStore"   autocomplete="false" /></td>
          <td align="right" width="100px">fMan:</td><td align="left" width="110px"><input   id="fetchManAdd" class="editerInput"  dojoType="dijit.form.TextBox"  /></td>
		  <td align="right" width="50px">fTel:</td><td align="left" width="130px"><input id="fetchTelAdd" class="editerInput"  dojoType="dijit.form.TextBox"  /></td>             
          <td align="right" width="100px">uMan:</td><td align="left" width="110px"><input id="unloadManAdd" class="editerInput"  dojoType="dijit.form.TextBox"  /></td>
          <td align="right" width="50px">uTel:</td><td align="left" width="130px"><input id="unloadTelAdd" class="editerInput"  dojoType="dijit.form.TextBox"  /></td>
        
          
        </tr><tr align="center" >  
          <td align="right"width="100px" >conveyance:</td><td align="left" width="140px"><input  id="conveyanceAdd"  class="editerInput"  dojoType="dijit.form.FilteringSelect" store="convStore" /></td>
          <td align="right" width="100px">carryType:</td><td align="left" width="140px"><input  searchAttr="name" id="carryTypeAdd" dojoType="dijit.form.FilteringSelect"   store="carryTypeStore"  class="editerInput"  autoComplete="true" /></td>
          <td align="right" width="100px" >planFetchTime:</td> <td align="left"  colspan="2"><input class="editerInput"  isInRange="changeD" id="planFetchTimeAdd1"  constraints="{datePattern:'yyyy-MM-dd' }" dojoType="dijit.form.DateTextBox"  /></td> <td align="left" ><input class="editerInput" isInRange="changeT" id="planFetchTimeAdd2"  value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}" required="true"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></td>
          <td align="right" width="100px" >planUnloadTime:</td> <td align="left"  colspan="2"><input class="editerInput"  isInRange="changeD" id="planUnloadTimeAdd1"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  /></td> <td align="left" ><input class="editerInput" isInRange="changeT" id="planUnloadTimeAdd2"  value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}" required="true"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></td>
        
        </tr><tr align="center" >
          <td align="right" width="100px" >contractNo:</td><td align="left" width="140px"><input class="editerInput" id="contractNoAdd"   dojoType="dijit.form.TextBox"  /></td> 
          <td align="right" width="100px" >custOrderNo:</td><td align="left" width="140px"><input class="editerInput" id="customerOrderNoAdd" maxLength="30" dojoType="dijit.form.TextBox"  /></td>
          <td align="right" width="100px" >shipperRemark:</td><td align="left" width="290px" colspan="3" rowspan="2"><textarea style="width:100%;height:42px" id="shipperRemarkAdd" rows=2></textarea></td>
          <td align="right" width="100px" >remark:</td><td align="left" width="290px" colspan="3"  rowspan="2" ><textarea style="width:100%;height:42px" id="remarkAdd" rows=2></textarea></td>
        </tr><tr align="center">
          <td align="right" width="100px" >*\u5ba2\u6237\u63d0\u4ea4\u65f6\u95f4:</td><td align="left" width="140px" ><input  id="referTimeAdd1" jsId="referTimeAdd1" class="editerInput"   isInRange="changeD" constraints="{datePattern:'yyyy-MM-dd'}"   dojoType="dijit.form.DateTextBox" /></td> 
          <td width="100px" align="left" > <input  id="referTimeAdd2" class="editerInput"  isInRange="changeT"   dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}" required="true" /></td> 
        </tr><!--tr align="center">
           <td colspan="2"></td><td colspan="2"><a onclick="call_funUpd();"><img src="../image/332.gif" height="20" width="20" border="0">save</a></td></tr> <tr height="6" ></tr--></table>
       <div id="gridSub"   dojoType="dojox.Grid" autoWidth="false" style="{width:1200px;height:200px;left:30px;}"  jsId="gridSub"	model="modelSub"  structure="layoutSub2" singleClickEdit="true" ></div>
                   
        </div>
        <div id="queryDiv" style="margin-right: 30px;  height: 460px; display:none;" >
              <table align="center" width=100% class="queryTable"  >
                <tr ><td align="center" style="{width:11%}">Please input criterial:</td>
                <td style="{width:22%}" ></td>
                <td style="{width:11%}"></td>
                <td style="{width:6%}" ></td>
                <td style="{width:11%}" ></td>
                <td style="{width:6%}" ></td>
                <td style="{width:11%}"></td>
                <td style="{width:22%}"></td></tr> 
                <tr ><td align="center" style="{width:11%}"></td>
                <td style="{width:22%}" ></td>
                <td style="{width:11%}"></td>
                <td style="{width:6%}" ></td>
                <td style="{width:11%}" ></td>
                <td style="{width:6%}" ></td>
                <td style="{width:11%}"></td>
                <td style="{width:22%}"></td></tr>  
                <tr>
                    <td align="right"  >customerOrderNo:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="querycustomerOrderNo"  jsId="querycustomerOrderNo"   dojoType="dijit.form.TextBox"  /></td>
                    <td align="right"  >contractNo:</td>
                    <td align="left"  colspan="3" ><input type="text" class="editerInput"  id="querycontractNo"  jsId="querycontractNo"   dojoType="dijit.form.TextBox"  /></td>  
                    <td align="right"  >conveyance:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="queryconveyance"  jsId="queryconveyance"   dojoType="dijit.form.TextBox"  /></td>  
              </tr>
                <tr>
                    <td align="right"  >carryType:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="querycarryType"  jsId="querycarryType"   dojoType="dijit.form.TextBox"  /></td>
                    <td align="right"  >shipperRemark:</td>
                    <td align="left"  colspan="3" ><input type="text" class="editerInput"  id="queryshipperRemark"  jsId="queryshipperRemark"   dojoType="dijit.form.TextBox"  /></td>  
                    <td align="right"  >carrierRemark:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="querycarrierRemark"  jsId="querycarrierRemark"   dojoType="dijit.form.TextBox"  /></td>  
              </tr>
                <tr>
                    <td align="right"  >wllevel:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="querywllevel"  jsId="querywllevel"   dojoType="dijit.form.TextBox"  /></td>
                    <td align="right"  >customerType:</td>
                    <td align="left"  colspan="3" ><input type="text" class="editerInput"  id="querycustomerType"  jsId="querycustomerType"   dojoType="dijit.form.TextBox"  /></td>  
                    <td align="right"  > </td>
                    <td align="right"  ></td>
                </tr><tr >
                    <td align="right"  >referTime:</td>
                    <td align="left"  colspan="3"><span id="queryreferTimeImg0"  ><input class="editerDate"   jsId="queryreferTime" id="queryreferTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTime" jsId="queryreferTimeTime" id="queryreferTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                        <span id="queryreferTimeImg1" style="{display:none}" ><input class="editerDateSmaller"   jsId="query1referTime" id="query1referTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTimeSmaller" jsId="query1referTimeTime" id="query1referTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                        <span hidefocus="true" style="{display:none}" onclick="selectSign(this);" id="queryreferTimeImgup">></span>
                        <img src="../image/start.gif" onclick="queryType(this);" id="queryreferTimeImg" height="15" width="20" border="0">
                        <span hidefocus="false"  style="{display:none}" onclick="selectSign(this);" id="queryreferTimeImgdown" >></span>
                        <span id="queryreferTimeImg2div" style="{display:none}"><input class="editerDateSmaller"   jsId="query2referTime" id="query2referTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTimeSmaller" jsId="query2referTimeTime" id="query2referTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                    </td>
                    <td align="right" colspan="2" ></td>
                    <td align="right"  >linkMan:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="querylinkMan"  jsId="querylinkMan"   dojoType="dijit.form.TextBox"  /></td>  
                <tr>
                    <td align="right"  >tel:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="querytel"  jsId="querytel"   dojoType="dijit.form.TextBox"  /></td>
                    <td align="right"  >bookTime:</td>
                    <td align="left"   colspan="5"><span id="querybookTimeImg0"  ><input class="editerDate"   jsId="querybookTime" id="querybookTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTime" jsId="querybookTimeTime" id="querybookTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                        <span id="querybookTimeImg1" style="{display:none}" ><input class="editerDateSmall"   jsId="query1bookTime" id="query1bookTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTimeSmall" jsId="query1bookTimeTime" id="query1bookTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                        <span hidefocus="true" style="{display:none}" onclick="selectSign(this);" id="querybookTimeImgup">></span>
                        <img src="../image/start.gif" onclick="queryType(this);" id="querybookTimeImg" height="15" width="20" border="0">
                        <span hidefocus="false"  style="{display:none}" onclick="selectSign(this);" id="querybookTimeImgdown" >></span>
                        <span id="querybookTimeImg2div" style="{display:none}"><input class="editerDateSmall"   jsId="query2bookTime" id="query2bookTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTimeSmall" jsId="query2bookTimeTime" id="query2bookTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                    </td>
                <tr>
                    <td align="right"   >completeTime:</td> 
                    <td align="left"  colspan="3"><span id="querycompleteTimeImg0"  ><input class="editerDate"   jsId="querycompleteTime" id="querycompleteTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTime" jsId="querycompleteTimeTime" id="querycompleteTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                        <span id="querycompleteTimeImg1" style="{display:none}" ><input class="editerDateSmaller"   jsId="query1completeTime" id="query1completeTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTimeSmaller" jsId="query1completeTimeTime" id="query1completeTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                        <span hidefocus="true" style="{display:none}" onclick="selectSign(this);" id="querycompleteTimeImgup">></span>
                        <img src="../image/start.gif" onclick="queryType(this);" id="querycompleteTimeImg" height="15" width="20" border="0">
                        <span hidefocus="false"  style="{display:none}" onclick="selectSign(this);" id="querycompleteTimeImgdown" >></span>
                        <span id="querycompleteTimeImg2div" style="{display:none}"><input class="editerDateSmaller"   jsId="query2completeTime" id="query2completeTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTimeSmaller" jsId="query2completeTimeTime" id="query2completeTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                    </td>
                    <td align="right" colspan="2" ></td>
                    <td align="right"  >formState:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="queryformState"  jsId="queryformState"   dojoType="dijit.form.TextBox"  /></td>  
                <tr>
                    <td align="right"   >planFetchTime:</td> 
                    <td align="left"  colspan="3"><span id="queryplanFetchTimeImg0"  ><input class="editerDate"   jsId="queryplanFetchTime" id="queryplanFetchTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTime" jsId="queryplanFetchTimeTime" id="queryplanFetchTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                        <span id="queryplanFetchTimeImg1" style="{display:none}" ><input class="editerDateSmaller"   jsId="query1planFetchTime" id="query1planFetchTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTimeSmaller" jsId="query1planFetchTimeTime" id="query1planFetchTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                        <span hidefocus="true" style="{display:none}" onclick="selectSign(this);" id="queryplanFetchTimeImgup">></span>
                        <img src="../image/start.gif" onclick="queryType(this);" id="queryplanFetchTimeImg" height="15" width="20" border="0">
                        <span hidefocus="false"  style="{display:none}" onclick="selectSign(this);" id="queryplanFetchTimeImgdown" >></span>
                        <span id="queryplanFetchTimeImg2div" style="{display:none}"><input class="editerDateSmaller"   jsId="query2planFetchTime" id="query2planFetchTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTimeSmaller" jsId="query2planFetchTimeTime" id="query2planFetchTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                    </td>
                    <td align="right" colspan="2" ></td>
                    <td align="right"  >fetchCompanyName:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="queryfetchCompanyName"  jsId="queryfetchCompanyName"   dojoType="dijit.form.TextBox"  /></td>  
                <tr>
                    <td align="right"  >fetchCompanyAddress:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="queryfetchCompanyAddress"  jsId="queryfetchCompanyAddress"   dojoType="dijit.form.TextBox"  /></td>
                    <td align="right"  >fetchMan:</td>
                    <td align="left"  colspan="3" ><input type="text" class="editerInput"  id="queryfetchMan"  jsId="queryfetchMan"   dojoType="dijit.form.TextBox"  /></td>  
                    <td align="right"  >fetchTel:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="queryfetchTel"  jsId="queryfetchTel"   dojoType="dijit.form.TextBox"  /></td>  
              </tr>
                <tr>
                    <td align="right"   >planUnloadTime:</td> 
                    <td align="left"  colspan="3"><span id="queryplanUnloadTimeImg0"  ><input class="editerDate"   jsId="queryplanUnloadTime" id="queryplanUnloadTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTime" jsId="queryplanUnloadTimeTime" id="queryplanUnloadTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                        <span id="queryplanUnloadTimeImg1" style="{display:none}" ><input class="editerDateSmaller"   jsId="query1planUnloadTime" id="query1planUnloadTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTimeSmaller" jsId="query1planUnloadTimeTime" id="query1planUnloadTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                        <span hidefocus="true" style="{display:none}" onclick="selectSign(this);" id="queryplanUnloadTimeImgup">></span>
                        <img src="../image/start.gif" onclick="queryType(this);" id="queryplanUnloadTimeImg" height="15" width="20" border="0">
                        <span hidefocus="false"  style="{display:none}" onclick="selectSign(this);" id="queryplanUnloadTimeImgdown" >></span>
                        <span id="queryplanUnloadTimeImg2div" style="{display:none}"><input class="editerDateSmaller"   jsId="query2planUnloadTime" id="query2planUnloadTime"  constraints="{datePattern:'yyyy-MM-dd'}" dojoType="dijit.form.DateTextBox"  />
                        <input class="editerTimeSmaller" jsId="query2planUnloadTimeTime" id="query2planUnloadTimeTime" value="00:00" dojoType="dijit.form.TimeTextBox" constraints="{timePattern:'HH:mm'}"   invalidMessage="Invalid time. Use HH:mm where HH is 00 - 23 hours."></span>
                    </td>
                    <td align="right" colspan="2" ></td>
                    <td align="right"  >unloadCompanyName:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="queryunloadCompanyName"  jsId="queryunloadCompanyName"   dojoType="dijit.form.TextBox"  /></td>  
                <tr>
                    <td align="right"  >unloadCompanyAddress:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="queryunloadCompanyAddress"  jsId="queryunloadCompanyAddress"   dojoType="dijit.form.TextBox"  /></td>
                    <td align="right"  >unloadMan:</td>
                    <td align="left"  colspan="3" ><input type="text" class="editerInput"  id="queryunloadMan"  jsId="queryunloadMan"   dojoType="dijit.form.TextBox"  /></td>  
                    <td align="right"  >unloadTel:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="queryunloadTel"  jsId="queryunloadTel"   dojoType="dijit.form.TextBox"  /></td>  
              </tr>
                <tr>
                    <td align="right"  >remark:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="queryremark"  jsId="queryremark"   dojoType="dijit.form.TextBox"  /></td>
	
          <tr align="center"><td></td>
           <td colspan="2"><a onclick="querybutton();"><img src="../image/332.gif" height="20" width="20" border="0">OK</a></td>
           <td colspan="3"></td><td colspan="2"></td></tr>
         </table>
	     </div>
	       	
	         <div align="right">
	          
                   <button dojoType="dijit.form.Button" id="but1" jsId="but1" onclick="addRowSub();"  disabled='true' iconClass="plusIcon">addSub</button>
         					 <button dojoType="dijit.form.Button" id="but2" jsId="but2" onclick="deleteSub();" disabled='true' iconClass="plusIcon">deleteSub</button>
         					 <button dojoType="dijit.form.Button" id="but3" jsId="but3" onclick="call_funUpd();" disabled='true' iconClass="plusIcon">save</button>
         					 <button dojoType="dijit.form.Button" id="but4" jsId="but4" onclick="hiddenbut()" disabled='true' iconClass="plusIcon">^</button>
	                 <button dojoType="dijit.form.Button" onclick="addRow();" iconClass="plusIcon" >add</button>
	                 <button dojoType="dijit.form.Button" onclick="removeSelectedRowsGrid();" iconClass="plusIcon" >delete</button>
	                 <button dojoType="dijit.form.Button" onclick="querydis();" iconClass="plusIcon" >query</button>
	                
	                 <button dojoType="dijit.form.Button" onclick="allopen();" id="but10" jsId="but10" iconClass="plusIcon">allopen</button>
	                 <button dojoType="dijit.form.Button" onclick="allclose();" id="but11" jsId="but11" iconClass="plusIcon">allclose</button>
	                 
	                         					 
         	 </div>				
	         
	         <!--div id="grid" jsId="grid" dojoType="dojox.VirtualGrid" get="get" structure="layout"  autoWidth="false" style="{height:800;width:98%;left:1}" ></div-->
	         <div id="grid" style="{height:800;width:99%;left:0}" ></div>
	         <div align="right" ><span id="rowCount"></span>
        <button dojoType="dijit.form.myButton" onclick="upPage();"  id="but6" disabled='true' jsId="but6" iconClass="upPageIcon" >pageup</button><!--span dojoType="dijit.Tooltip" connectId="but6">pageup</span-->
        <button dojoType="dijit.form.myButton" onclick="downPage();" id="but7" disabled='true' jsId="but7" iconClass="downPageIcon" >pagedown</button><!--span dojoType="dijit.Tooltip" connectId="but7">pagedown</span-->
        <div id="668" dojoType="dijit.form.myDropDownButton" iconClass="pageIcon" ><span>pageNumber</span>
  			  <div dojoType="dijit.Menu">
				  <div dojoType="dijit.MenuItem" label="10"  iconClass="toPageIcon"		onClick="pageSizeChange(this.label);"></div>
				  <div dojoType="dijit.MenuItem"  label="30" iconClass="toPageIcon"		onClick="pageSizeChange(this.label);"></div>
		      <div dojoType="dijit.MenuItem"  label="50" iconClass="toPageIcon"		onClick="pageSizeChange(this.label);"></div>
					<div dojoType="dijit.MenuItem"  label="100" iconClass="toPageIcon"	onClick="pageSizeChange(this.label);"></div>
					<div dojoType="dijit.MenuItem"  label="noPage" iconClass="noPageIcon"	onClick="allpage();"></div>
		      </div><!--span dojoType="dijit.Tooltip" connectId="668"></span-->
        </div>
		    <div id="669" dojoType="dijit.form.myDropDownButton" iconClass="pageStyleIcon"><span>pageStyle</span>
  			   <div dojoType="dijit.Menu">
  				 <div dojoType="dijit.MenuItem"  iconClass="rowIcon"		label="row"	onClick="pageStyle(this.label);"></div>
  				 <div dojoType="dijit.MenuItem"  iconClass="colIcon"		label="col"	onClick="pageStyle(this.label);"></div>
		    </div></div>
     </div> 
	         
</body></html>	
